﻿@model RiderShop.Mobile.Modle.CustomerModel
@{
    Layout = "../Shared/_MobileLayout.cshtml";
}
@section header
{
    <link rel="stylesheet" href="~/Themes/RongJi/Style/base/css/sign.css">
}
@section title
{
    用户注册
}
@section pagetitle
{
    用户注册
}
<div class="top"><img src="~/Themes/RongJi/Style/base/imgs/signup_top.jpg" alt=""></div>
<form action="~/Customer/PhoneRegister" method="POST" id="submitForm">
    <div class="body">

        <input type="hidden" id="returnUrl" name="returnUrl" value="@Model.ReturnUrl" />

        <input type="text" id="CellPhone" class="form-control" name="CellPhone" placeholder="请输入手机号" value="@Model.CurrentUser.CellPhone">
        <div class="form-group">
            <input name="PasswordAnswer" type="tel" id="PasswordAnswer" class="form-control verifyCode" placeholder="验证码" />
            <input type="button" class="btn btn-success verifyBtn" id="getCode" value="获取验证码" />
            <br class="clearfix" />
        </div>
        <input type="password" id="Password" class="form-control" name="Password" placeholder="请输入密码" maxlength="20" autocomplete="off">

        @if (Model.Result != null && !Model.Result.Status)
        {
            <span class="err_msg">@Model.Result.ErrorMessage</span>
        }
        else
        {
            <span class="err_msg" id="msgError"></span>
        }
    </div>
    <div class="bottom">
        <img src="~/Themes/RongJi/Style/base/imgs/ss.jpg" alt="">
        <div class="btn-group btn-group-justified btn-wrapper" role="group" aria-label="...">
            <div class="btn-group" role="group">
                <input class="btn btn-green" type="button" data-role="button" id="btnSubmit" value="提交">
            </div>
            <div class="btn-group" role="group">
                <button type="button" class="btn" onclick="window.history.go(-1);">取消</button>
            </div>
        </div>
    </div>
</form>
@section footer
{

    <script type="text/javascript">
        $(function () {

            var isCodeSended = false;
            var timeOut = 60;
            $("#getCode").click(function () {
                if (isCodeSended) {
                    return;
                }
                if (!$("#CellPhone").val()) {
                    KevinShop.MessageBox.Alert("请输入手机号!");
                    return;
                }
                isCodeSended = true;

                var postdata = "{'userName':'','cellPhone':'" + $("#CellPhone").val() + "','type':7}"
                KevinShop.Common.Ajax.Post("SendSMSValdateCode", postdata, function (data) {
                    if (data) {
                        isCodeSended = false;
                        KevinShop.MessageBox.Alert(data);
                    }
                    else {
                        updateTime(timeOut);
                        KevinShop.MessageBox.Alert("发送成功！");
                    }
                });
            });

            function updateTime(timeout) {
                $("#getCode").val('获取(' + timeout + ')');
                setTimeout(function () {
                    if (timeout > 0) {
                        updateTime(timeout - 1);
                    }
                    else {
                        isCodeSended = false;
                    }
                }, 1000);
            }

            $("#btnSubmit").click(function () {
                if (!$("#CellPhone").val()) {
                    KevinShop.MessageBox.Alert("请输入手机号!");
                    return false;
                }

                if (!$("#PasswordAnswer").val()) {
                    KevinShop.MessageBox.Alert("请输入验证码!");
                    return false;
                }

                if (!$("#Password").val()) {
                    KevinShop.MessageBox.Alert("请输入密码!");
                    return false;
                }


                document.forms["submitForm"].submit();
            });
        });

 

    </script>
}
